home *** CD-ROM | disk | FTP | other *** search
/ Amiga News 95 / Amiga News 95.iso / dpat / dpat14 / log / log.rexx-english < prev   
Text File  |  1992-10-21  |  4KB  |  156 lines

  1. /* AREXX SCRIPT log.rexx
  2.  
  3.    Stores all boot up times (including after a '3 fingers salute', and after
  4.    a guru) and shut down times to file 'logonpath'/BootLogFile.
  5.    ***(WITH a bit of YOUR HELP ;-)***
  6.    
  7.    ie: file Temp:logon/BootLogFile may contain:
  8.    ...
  9.    Sa_26-Sep_09:12 - Power up time.
  10.    Sa_26-Sep_13:45 - Guru: culprit not known!
  11.    ...
  12.    SA_26-Sep_15:28 - Reset: this silly ***** program hung again!!
  13.    Sa_26-Sep_23:58 - Shut down time.
  14.    ----------------------------------
  15.    Su_27-Sep_08:23 - Power up time.
  16.       
  17.    Dont forget to put "rx log on" near the end of your startup-sequence,
  18.    and AFTER "rexxmast" and IPrefs ;-), and to edit the 'starred' line below!
  19.    
  20.    call 'rx log off' before shutting down the system.
  21.    
  22.    written 26-Sep-92 Gérard Cornu
  23.    
  24.  
  25.    Change the part of the following line to the PATH (without the filename),
  26.    where you want your logon file to be.                                   /
  27.   \                                                                       /
  28.    \_______                   ___________________________________________/ 
  29.            \ THIS PART ONLY  /
  30.             \               /                                              */
  31. logonpath = "temp:logon/"     /* <---- edit here ************************
  32.                            ^
  33.                            | 
  34.                   don't forget the / or :
  35.                  ~~~~~~~~~~~~~~~~~~~~~~~~~
  36. */                  
  37.  
  38. arg switch
  39.  
  40. logonfile = "BootLogFile"
  41.  
  42. hil = ""
  43. nor = ""
  44.  
  45. option results  
  46.  
  47. day  = left(date('weekday'),2)
  48. date = left(space(date(), 1, '-'), 6)
  49. time = left(time(), 5)
  50. datetime = day||'_'||date||'_'||time
  51.  
  52. if switch = 'ON' then do
  53.    say "c" /* clear screen */
  54.    query = getbootup()
  55. end
  56. else if switch = 'OFF' then do 
  57.    query = " - Shut down time."
  58. end   
  59.    
  60. if(~exists(logonpath||logonfile)) then
  61.    mode = 'W'
  62. else mode = "A"
  63.  
  64. if ~open(datefile, logonpath||logonfile,mode) then do
  65.    say ""
  66.    say "Could not open "||logonpath||logonfile|| "...aborting."
  67.    say ""
  68.    exit 20
  69. end   
  70.  
  71. if mode = "W" then do
  72.    writeln(datefile, " ***      Log file created by log.rexx     ***") 
  73.    writeln(datefile, " ***  written by Gérard Cornu (26-Sep-92)  ***")
  74.    writeln(datefile, "")
  75. end   
  76.  
  77. writeln(datefile, datetime||query)
  78. if switch = 'OFF' then do
  79.    writeln(datefile, "----------------------------------")
  80. end   
  81.  
  82. close(datefile)
  83.  
  84. say "c"
  85.  
  86. exit 0
  87.  
  88. /*--------------------------------- E N D --------------------------------*/   
  89.  
  90. /*--------------------------- getbootup()----------------------------*/
  91. getbootup:
  92.            
  93. say "c"
  94. say ""
  95. say "         As you probably know (;-), your system is now booting-up!"
  96. say "         And I've been  assigned the task of keeping a log file of"
  97. say "         this process, so I would be much grateful if you can help"
  98. say "         me by giving me some info."
  99. say ""
  100. say "         What is this boot-up due to:"
  101. say ""
  102. say hil||"                         N"||nor||" - Normal power-up"
  103. say 
  104. say hil||"                         R"||nor||" - Reset (ctrl-Amiga-Amiga)"
  105. say
  106. say hil||"                         G"||nor||" - Guru"
  107. say
  108. say hil||"                         C"||nor||" - Power cut"
  109. say
  110. say hil||"                         V"||nor||" - Fear of virus"
  111. say
  112. say
  113. say
  114.  
  115. bootup = ""
  116.  
  117. do while ((bootup ~= "N") ^ (bootup ~= "C") ^ (bootup ~= "V"),
  118.         ^ (bootup ~= "G") ^ (bootup ~= "R"))
  119.    say ""
  120.    writech(stdout, "AA         Please enter "||hil||"n"||nor||", "||hil||"r"||nor,
  121.    ", "||hil||"g"||nor", "||hil||"c"||nor||" or "||hil||"v"||nor||" ? ")
  122.    pull bootup
  123. end
  124.  
  125. select
  126.    when bootup = "N" then query = " - Power up time." 
  127.    when bootup = "C" then query = " - Power cut: "
  128.    when bootup = "V" then query = " - Fear of virus: "   
  129.    when bootup = "G" then query = " - Guru: "
  130.    when bootup = "R" then query = " - Reset: "
  131.    otherwise exit(20)
  132. end
  133.  
  134. if bootup = "C" | bootup = "V" | bootup = 'G' | bootup = 'R' then do
  135.    query = query||getmoreinfo(query)
  136. end
  137. return query
  138.  
  139. /*------------------------ getmoreinfo() ------------------------------*/
  140. getmoreinfo:
  141.  
  142. arg item
  143.  
  144. say
  145. say 
  146. say "         Please give me more info about this "||item
  147. writech(stdout, "         or just [enter] if none ? ")
  148.  
  149. parse pull moreinfo
  150.  
  151. if moreinfo = "" then moreinfo = "???"
  152.  
  153. return moreinfo
  154. /*------------------------------------------------------------------*/
  155.  
  156.